home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-29 | 10.0 KB | 267 lines | [TEXT/Moml] |
- Mosml Mac 1.42e Developers Readme 1997Jul26 e <e@flavors.com>
-
- Read README.Mac first if you want to know how to use Moscow ML.
-
- Read !README.first about installing the source files.
-
- This file describes how to build Mac Moscow ML from the sources.
-
- I used Metrowerks CodeWarrior Pro 1 to port Moscow ML 1.42.
- The CodeWarrior Pro project files are included.
-
- Because mosmlyac and runtime have identically named files in them, I
- found it necessary to rename folder "runtime" to "!runtime" so Metrowerks
- would choose the right files. I could have also solved this problem by
- putting the project files into the runtime folder (as I did by putting the
- mosmlyac project into mosmlyac) but I didn't. Why? I like to debug from the
- Metrowerks debugger and so I want the project to live in the same directory
- as the finished application.
-
- I deliberately named the distribution directory mosml142. If you rename the
- linux toplevel folder to mosml142 you can use CompactPro to install the
- .sea files as updates. Without renaming, you can't use Stuffit to obliterate
- the linux files with the update directories. It's my pet peeve, sorry.
-
- The directory structure to three levels is as follows:
-
- ANSIshellÆ’ -- the eConsole & eEdit sources
- <lots of files>
- mosml142
- e_mac -- mosml <-> eConsole & MacOS glue
- dirent.h
- e_access.c
- e_cgi_main.c
- e_dirent.c
- e_filelink.c
- e_getenv.c
- e_gettimeofday.c
- e_graph.c
- e_stat.c
- e_system.c
- m.h
- mac_main.c
- mac_os.c
- mac_os.h
- momlmenus.c
- momlmenus.h
- mosml.rsrc
- mosml_cgi.rsrc
- os_mac_cmdmenu.c
- os_mac_options.h
- prims_cgi.c
- rename_patch.c
- s.h
- sys/param.h
- sys/resource.h
- sys/stat.h
- sys/time.h
- sys/times.h
- sys/types.h
- sys/unistd.h
- sys/utsname.h
- ui.h
- uio.c
- e_SML -- see the Readme file in that folder
- <a few files>
- lib -- the Moscow ML library object code
- <many files>
- lib_extra -- things to copy to any new lib
- <a few files>
- MacReleaseNotes.txt
- mosml.image -- toplevel includes make & link
- mosml142.prj -- CWPro project
- mosml142app -- ppc application
- mosml142app.lib -- ppc shared library
- mosml142cgi -- ppc cgi application
- mosml142cgi.lib -- ppc cgi shared library
- mosml142m68.sea -- 68k applications compressed
- mosmllex.image -- the lexer
- mosmllink.image -- the linker (redundant)
- MSLpatches -- source patches to MetroWerks Standard Library
- <a few files>
- README.Mac
- README.MacDev
- src -- additions & replacements to the linux source
- !runtime...
- compiler...
- lex...
- mosmllib...
- mosmlyac...
- mosmlyacc.prj -- CWPro project
- mosmlyacc68k -- 68k application
- mosmlyaccPPC -- ppc application
- test...
- tools...
- toolssrc...
-
- With all the files in place, the mosml apps and shared libraries can be
- re-built from the sources simply by opening the project file and doing
- a Make. You'll need MetroWerks CodeWarrior Pro. [It may be necessary to
- fix a path for ANSIShellÆ’ in the Load Paths preferences, but shouldn't.]
-
- ** Unfortunately this may not be true if you're using an unpatched version of
- CodeWarrior Pro, see the file MSLpatches:Readme.MSL
-
- *** Note: There's a bit of pre-processing of the files that in UNIX
- versions of mosml takes place via sed, awk, perl, cpp, etc. All of these
- intermediate files are provided in this Mac version.
- If you have sed, awk, perl, cpp, etc. then you may prefer to grok the
- make scripts and generate these files yourself -- it is safer to do so
- since they are generated from sources independent of this archive.
-
- Here are some basic rules:
-
- .grm files are processed by mosmlyac, which is supplied. Move mosmlyac
- temporarily to the folder with the .grm file, launch it, type in the .grm
- file name, and that's it. Move mosmlyac back to its folder.
-
- .lex files are processed with mosmllex, which is also supplied. The file
- e_SML:make_mosml.sml has a few command lines which can be used with mosml
- to process the .lex files in the usual distribution.
-
- .mlp files are processed by cpp, the C pre-processor. I do this by hand
- since the MetroWerks compiler is freaked out by ML syntax.
-
- A few other files must be created using sed, awk, and perl. I've supplied
- all of these intermediate files since these tools are not widely used on
- the Mac. A few perl droplets are supplied anyway in case you need to redo
- my work. Drop runtime's instruct.h onto mksmlopc to make Opcodes.sml.
- Launch mksmlpre and supply the command line...
- ::!runtime:globals.h ::!runtime:fail.h
- to make Predef.sml. Making Prim_c.sml (and prims.c) is harder since it
- first requires making the file "primitives" [which requires sed and awk
- and running a UNIX shell script, if you believe the make file]. Once you
- have primitives [I made mine by hand] you can drop it onto mksmlprc to make
- Prim_c.sml. [Warning: I haven't actually used these perl scripts since
- version 1.40, I think. Use at your own risk. I hate perl. -- e]
-
- I've also supplied a file make_opcodes.sml that can make Opcodes.sml
-
- If you already have the mosml object files in your lib (e.g., from
- the application release), the following step isn't necessary, just
- launch mosml142m68 or mosml142app. This step is only necessary when there
- are no object files in the lib or you have edited the library sources in
- src:mosmllib or other src: files...
-
- With the existing or new mosml142m68 or mosml142app, you can recreate all
- the mosml object files by following the script in e_SML:make_mosml.sml.
- This script compiles all source files in the distribution, creates the
- images for the toplevel and lexer, and copies the new library files to
- a new folder called lib2:. You should manually copy the files in lib_extras
- to lib2, and rename lib2 to lib when you are satisfied with it.
-
- The files in lib_extras are derived from the linux sources or are simply
- renamed version of General.fke, Meta.fke in src:mosmllib. There are
- instructions in e_SML:helpsigsmake.mac on how to make the htmlsigs and
- helpsigs.val documentation files.
-
- (* *)
-
- This section is certainly only of historical interest.
-
- Here is some detail about what I have done to make mosml 1.30 work on the
- Mac...
-
- I already had The Caml Light 0.7 runtime working on the Mac with my own
- console/editor environment. This code (which I'll call eConsole)
- supplies some of the missing UNIX functions such as timers for user,
- system, and gc, and of course, terminal i/o. Also for Caml Light and
- SML/NJ, I had implemented UNIX -> Mac pathname translation and included
- it in the runtime. This supports using UNIX created images (e.g.,
- mosmlcmp) in the Mac environment.
-
- So, step one was diff'ing mosml 1.30 and my custom Caml Light 0.7
- runtimes to merge my stuff in. This was not hard; although mosml seems
- to be based on an early 0.7 beta, I got my stuff in easily. A few
- changes were required for the MetroWerks 68k compiler. I also added in
- my user, system, and gc timer.
-
- Then I created replacements for some of the missing UNIX functions.
- These include access, readdir, etc. I also made several files such as
- "sys/unistd.h" that are simply one line: #include <unistd.h>. This makes
- modification of the mosml sources that include "sys/xxx.h" files
- unnecessary. It also makes a convenient place to put special unixfoolery
- such as defining F_OK, and overriding MWERKS flawed implementations,
- e.g., of chdir.
-
- It was also necessary to add a couple macros to mosml.c to adjust the
- Mac time (1904 base) to UNIX time (1970 base) and back.
-
- Then I could compile and link the world. I did this one file at a time.
- [Now that I have made make, this will never again be necessary!?]
-
- The SML changes I made were few.
-
- In mosmllib I hooked in my gc timer (UNIX and DOS don't have one), I
- hooked in osInfo (sml_uname), and fixed or worked around a couple bugs
- [these are now reported/fixed]. The changed files are:
-
- Mosml.sml gc timer
- Timer.sml gc timer
- OS.sml sml_uname (should be changed: OS.mlp)
-
- FileSys.sml -- I used the DOS version at first, then custom
- Path.sml -- I used the UNIX version at first, then custom
-
- and these files which, I think, are equivalent to what cpp would have
- done:
-
- Array.sml
- Integer.sml
- Strbase.sml
- Vector.sml
- Word.sml
- Word8Array.sml
- Word8Vector.sml
-
- In compiler I changed:
-
- Smltop.sml to add chDir and gc_full_major
- Link.sml to make missing_globals a ref
- Symtable.sml to add protect_linker_tables
- Symtable.sig to make this visible
-
- The purpose of the linker changes is twofold. In order to do a link in a
- toplevel environment it is necessary to save and restore the current
- environment. All the effected data are in the Symtable unit [as I said
- above, this isn't well tested]. protect_linker_tables was added to
- this job. The second part of the change in to make missing_globals a
- ref. This change was also made by INRIA at my request in Caml Light.
- This is needed because the missing_globals hashtable gets very big for
- some links, and never shrinks. In fact is seems to get bigger with
- every link. To conserve memory the new link disposes the table after
- every link.
-
- I also created:
-
- Opcodes.sml
- Predef.sml
- Parser.sig
- Parser.sml
- Filename.sml
- Config.sml
- Lexer.sml
-
- from the requisite sources.
-
- Then I added the new sources for Smltope and Maine.
-
- The only files I changed in runtime are:
-
- mosml.c Mac <-> UNIX time, e_getrusage
- floats.c used Caml Light 0.7 version (has my compiler fixes)
- misc.c kill bogus malloc prototype
- minor_gc.c gc timer
- major_gc.c gc timer
- misc.h includes <stdlib.h> for malloc bug
- prims.c generated file
- main.c [I don't remember, I'll diff it later]
- interp.c punt spin (it's in ui.h)
- fail.c #define MAXDOUBLE
- config.h MWERKS friendly m.h & s.h includes
- sys.c UNIX -> Mac pathname translation
-
- I also added a bunch of new files for eConsole and unixfoolery.
-
- e
-